<?php
namespace app\admin\model;
use think\Model;
class Warehouse extends Model
{
    public function saveWarehouse(array $warehouse_info)
    {
        $warehouse = new Warehouse;
        $warehouse_list = [
            'warehouse' => $warehouse_info['warehouse'],
        ];
        if (isset($warehouse_info['id'])){
            $result = $warehouse->save($warehouse_list,['id'=>$warehouse_info['id']]);
        }else {
            $warehouse_list['created'] = time();
            $result = $warehouse->save($warehouse_list);
            $result = $warehouse->id;
        }
        return $result;
    }
    
    public function getAllWarehouse()
    {
    	$warehouse_list = db('warehouse')->field(['id','warehouse'])->select();
    	return $warehouse_list;
    }
}